import { LcDocument } from '@/types/modules/editor/types/editor.type';
import { ITypeEntity } from '../services/transformers/ResourceTransform';
import { checkTypeFullyLoaded } from '../utils/entryFactory';

export class VirtualFileSystemConfig {
  private static instance: VirtualFileSystemConfig;

  static getInstance() {
    if (!VirtualFileSystemConfig.instance) {
      VirtualFileSystemConfig.instance = new VirtualFileSystemConfig();
    }
    return VirtualFileSystemConfig.instance;
  }

  checkDocumentNeedLoadSource(doc: LcDocument) {
    return !doc.schema;
  }

  checkTypeEntityNeedLoadSource(typeEntity: ITypeEntity) {
    const isFullyLoaded = checkTypeFullyLoaded(typeEntity);
    if (isFullyLoaded) {
      return false;
    }
    return true;
  }
}
